package rocket

import (
	mq_http_sdk "github.com/aliyunmq/mq-http-go-sdk"
	"time"
)

type (
	delayPusher struct {
		producer mq_http_sdk.MQProducer
		Tag      string
	}
)

//func (p *DelayPusher) Name() string {
//	return p.producer.TopicName()
//}

func (p *delayPusher) Push(message string, deliverTime time.Time) error {
	msg := mq_http_sdk.PublishMessageRequest{
		MessageBody: message,
		MessageTag:  p.Tag,
	}
	msg.StartDeliverTime = deliverTime.UTC().Unix() * 1000
	_, err := p.producer.PublishMessage(msg)
	return err
}
